import { PokerHand } from "./PokerHand.js";
import { PokerCard } from "../PokerCard.js";
export type { PokerCard, PokerType } from "../PokerCard.js";

/** 单牌 */
export class SinglePokerHand extends PokerHand {
  public value: number;
  constructor(cards: PokerCard[]) {
    super(cards);

    this.value = cards[0].value;
  }

  /**
   * 判断是否为单牌：单个牌（如红桃 5 ）。
   * @param cards 手牌
   * @returns
   */
  public static isStandard(cards: PokerCard[]) {
    return cards.length === 1;
  }
  public isStandard = SinglePokerHand.isStandard;
  public isBetter(target: PokerHand): boolean {
    if (target instanceof SinglePokerHand) {
      return this.value > target.value;
    }

    return false;
  }
}

export default SinglePokerHand;
